var e = require("../../common/vendor.js"), t = require("../../api/ajax.js");

require("../../api/service.js"), require("../../utils/luch-request/core/Request.js"), 
require("../../utils/luch-request/core/dispatchRequest.js"), require("../../utils/luch-request/adapters/index.js"), 
require("../../utils/luch-request/helpers/buildURL.js"), require("../../utils/luch-request/utils.js"), 
require("../../utils/luch-request/core/buildFullPath.js"), require("../../utils/luch-request/helpers/isAbsoluteURL.js"), 
require("../../utils/luch-request/helpers/combineURLs.js"), require("../../utils/luch-request/core/settle.js"), 
require("../../utils/luch-request/core/InterceptorManager.js"), require("../../utils/luch-request/core/mergeConfig.js"), 
require("../../utils/luch-request/core/defaults.js"), require("../../utils/luch-request/utils/clone.js"), 
require("../../uni_modules/u-store/js_sdk/Storage.js"), require("../../config/config.js");

var r = {
    setup: function() {
        var t = e.useStore();
        return {
            upInfo: function(e) {
                t.commit("showCar/upInfo", e);
            },
            showCar: t.state.showCar
        };
    },
    data: function() {
        return {
            show: !1,
            show1: !1,
            show2: !1,
            category0: "请选择",
            category1: "请选择",
            parent_id: 0,
            product: "请选择",
            infoData: [],
            PickerData: [],
            PickerIslast: [],
            PickerColumns: [],
            PickerData1: [],
            PickerIslast1: [],
            PickerColumns1: [],
            productId: [],
            productPrice: [],
            productColumns: [],
            dataList: [ {
                name: "车顶",
                value: "10%",
                shu: "0.1"
            }, {
                name: "后杠",
                value: "20%",
                shu: "0.2"
            }, {
                name: "后备箱",
                value: "10%",
                shu: "0.1"
            }, {
                name: "后门",
                value: "10%",
                shu: "0.1"
            }, {
                name: "后叶",
                value: "25%",
                shu: "0.25"
            }, {
                name: "前杠",
                value: "20%",
                shu: "0.2"
            }, {
                name: "前门",
                value: "10%",
                shu: "0.1"
            }, {
                name: "前叶",
                value: "10%",
                shu: "0.1"
            }, {
                name: "引擎盖",
                value: "15%",
                shu: "0.15"
            } ]
        };
    },
    onPullDownRefresh: function(e) {
        this.getPickerData(!0);
    },
    onLoad: function() {
        this.getPickerData(!1);
    },
    methods: {
        showCategoryPicker: function() {
            if (!this.showCar.carInfo.series_id) return e.index.showToast({
                title: "请先选择车型！",
                icon: "none"
            }), !1;
            this.show1 = !1, this.show2 = !1, this.category0 = "请选择", this.category1 = "请选择", 
            this.product = "请选择", this.$refs.categoryPicker.open(), this.hideKeyboard();
        },
        showCategoryPicker1: function() {
            this.$refs.categoryPicker1.open(), this.hideKeyboard();
        },
        showProductPicker: function() {
            if (!this.showCar.carInfo.series_id) return e.index.showToast({
                title: "请先选择车型！",
                icon: "none"
            }), !1;
            this.$refs.productPicker.open(), this.hideKeyboard();
        },
        pickerConfirm: function(e) {
            this.category0 = e.value[0];
            var t = e.indexs[0], r = this.PickerIslast[t], i = this.PickerData[t];
            0 == r ? (this.show1 = !1, this.show2 = !0, this.getInfoList(i)) : (this.show1 = !0, 
            this.getPickerData1(i));
        },
        pickerConfirm1: function(e) {
            this.category1 = e.value[0];
            var t = e.indexs[0], r = this.PickerIslast1[t], i = this.PickerData1[t];
            0 == r ? (this.show1 = !0, this.show2 = !0, this.getInfoList(i)) : (this.show1 = !0, 
            this.show2 = !0, this.getPickerData1(i));
        },
        productConfirm: function(e) {
            console.log("productConfirm", e), this.show = !0;
            var t = e.indexs[0];
            this.product = e.value[0], this.price = this.productPrice[t];
            var r = this.productId[t];
            this.getInfoData(r);
        },
        getPickerData: function(r) {
            var i = this;
            t.doGetUrl("product.Category/category1").then(function(t) {
                var o = t.data.data;
                i.PickerData = o.data, i.PickerIslast = o.islast, i.PickerColumns = o.columns, r && e.index.stopPullDownRefresh();
            });
        },
        getPickerData1: function(e) {
            var r = this;
            t.doGetUrl("product.Category/category1", {
                parent_id: e
            }).then(function(e) {
                var t = e.data.data;
                r.PickerData1 = t.data, r.PickerIslast1 = t.islast, r.PickerColumns1 = t.columns;
            });
        },
        getInfoList: function(e) {
            var r = this;
            t.doGetUrl("product.Category/columns", {
                category_id: e
            }).then(function(e) {
                var t = e.data.data;
                r.productColumns = t.title, r.productPrice = t.price, r.productId = t.id;
            });
        },
        getInfoData: function(e) {
            var r = this;
            t.doGetUrl("product.Product/detail", {
                product_id: e
            }).then(function(e) {
                var t = e.data.data;
                r.infoData = t, r.show = !0;
            });
        },
        clickPrice: function(t) {
            if (!this.infoData.product_id) return e.index.showToast({
                title: "请先选择产品！",
                icon: "none"
            }), !1;
            Number(this.price), Number(t.shu), e.index.showToast({
                title: "单贴" + t.name + "：" + Number(this.price) * Number(t.shu) + "元",
                icon: "none"
            });
        },
        goDetail: function(t) {
            e.index.navigateTo({
                url: "/pages/product/detail?id=" + t.product_id
            });
        },
        goPage: function(t) {
            e.index.navigateTo({
                url: "/pages/" + t
            });
        },
        hideKeyboard: function() {
            e.index.hideKeyboard();
        }
    }
};

Array || (e.resolveComponent("uv-image") + e.resolveComponent("uv-list-item") + e.resolveComponent("uv-list") + e.resolveComponent("uv-cell") + e.resolveComponent("uv-cell-group") + e.resolveComponent("uv-gap") + e.resolveComponent("uv-grid-item") + e.resolveComponent("uv-grid") + e.resolveComponent("uv-divider") + e.resolveComponent("uv-picker"))(), 
Math || (function() {
    return "../../uni_modules/uv-image/components/uv-image/uv-image.js";
} + function() {
    return "../../uni_modules/uv-list/components/uv-list-item/uv-list-item.js";
} + function() {
    return "../../uni_modules/uv-list/components/uv-list/uv-list.js";
} + function() {
    return "../../uni_modules/uv-cell/components/uv-cell/uv-cell.js";
} + function() {
    return "../../uni_modules/uv-cell/components/uv-cell-group/uv-cell-group.js";
} + function() {
    return "../../uni_modules/uv-gap/components/uv-gap/uv-gap.js";
} + function() {
    return "../../uni_modules/uv-grid/components/uv-grid-item/uv-grid-item.js";
} + function() {
    return "../../uni_modules/uv-grid/components/uv-grid/uv-grid.js";
} + function() {
    return "../../uni_modules/uv-divider/components/uv-divider/uv-divider.js";
} + function() {
    return "../../uni_modules/uv-picker/components/uv-picker/uv-picker.js";
})();

var i = e._export_sfc(r, [ [ "render", function(t, r, i, o, s, u) {
    return e.e({
        a: e.p({
            src: "/static/product/banner.jpg",
            width: "750rpx",
            mode: "widthFix"
        }),
        b: e.o(function(e) {
            return u.goPage("car/brand");
        }),
        c: e.p({
            title: o.showCar.carInfo.series_name,
            note: o.showCar.carInfo.firms_name,
            thumb: o.showCar.carInfo.brand_titlepic,
            "thumb-size": "lg",
            rightText: o.showCar.carInfo.brand_name,
            "show-arrow": !0,
            clickable: !0
        }),
        d: e.o(function(e) {
            return u.showCategoryPicker();
        }),
        e: e.p({
            title: "选择类型",
            value: s.category0,
            isLink: !0
        }),
        f: s.show1
    }, s.show1 ? {
        g: e.o(function(e) {
            return u.showCategoryPicker1();
        }),
        h: e.p({
            title: "选择系列",
            value: s.category1,
            isLink: !0
        })
    } : {}, {
        i: s.show2
    }, s.show2 ? {
        j: e.o(function(e) {
            return u.showProductPicker();
        }),
        k: e.p({
            title: "选择产品",
            value: s.product,
            isLink: !0
        })
    } : {}, {
        l: s.show
    }, s.show ? {
        m: e.t(t.price)
    } : {}, {
        n: e.p({
            height: "30"
        }),
        o: e.f(s.dataList, function(t, r, i) {
            return {
                a: e.t(t.name),
                b: e.t(t.value),
                c: r,
                d: e.o(function(e) {
                    return u.clickPrice(t);
                }, r),
                e: "df5a2743-11-" + i + ",df5a2743-10"
            };
        }),
        p: e.p({
            border: !0
        }),
        q: e.p({
            text: "以上为局部价格占比"
        }),
        r: e.p({
            src: "/static/image/bottom.png",
            width: "750rpx",
            mode: "widthFix"
        }),
        s: e.sr("categoryPicker", "df5a2743-14"),
        t: e.o(u.pickerConfirm),
        v: e.p({
            columns: s.PickerColumns,
            activeColor: "blue"
        }),
        w: e.sr("categoryPicker1", "df5a2743-15"),
        x: e.o(u.pickerConfirm1),
        y: e.p({
            columns: s.PickerColumns1,
            activeColor: "blue"
        }),
        z: e.sr("productPicker", "df5a2743-16"),
        A: e.o(u.productConfirm),
        B: e.p({
            columns: s.productColumns,
            activeColor: "blue"
        })
    });
} ], [ "__scopeId", "data-v-df5a2743" ] ]);

wx.createPage(i);